package com.cloudlead.fleetAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.fleetAction.BusinessModules;
import com.cloudlead.fleetAction.service.FleetDoorSer;
import com.cloudlead.fleetService.FleetDoorService;
import com.cloudlead.fleetService.vo.BaseFleetDoorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.validation.constraints.NotNull;

@Controller
/**
 * Created by Will on 2015/12/16.
 */
public class FleetDoorActionFactory extends AbstractActionFactory implements FleetDoorService {
    @Autowired
    FleetDoorSer fleetDoorSer;
    public FleetDoorActionFactory() {
        super(BusinessModules.FleetDoor);
    }
    @Override
    @Action
    @Order(1)
    @Label("新增车队门点")
    public String addFleetDoo(BaseFleetDoorVo baseFleetDoorVo) {
        return fleetDoorSer.addFleetDoor(baseFleetDoorVo);
    }

    @Override
    @Action
    @Order(2)
    @Label("删除车队门点")
    public String delFleetDoo(@NotNull @Label("车队门点ID")String fleetDoorId) {
        return fleetDoorSer.delFleetDoor(fleetDoorId);
    }

    @Override
    @Action
    @Order(3)
    @Label("编辑车队门点")
    public String editFleetDoo(BaseFleetDoorVo baseFleetDoorVo) {
        return fleetDoorSer.editFleetDoor(baseFleetDoorVo);
    }

    @Override
    @Action
    @Order(4)
    @Label("查询车队门点")
    public EasyuiGridData findAll(BaseFleetDoorVo baseFleetDoorVo, @NotNull @Label("每页记录条数")int rows, @NotNull @Label("页码")int page) {
        return new EasyuiGridData(fleetDoorSer.findAll(baseFleetDoorVo,rows,page),"id,contactPerson,doorName," +
                "doorAddress,baseFleetCustomer.companyName companyName,baseFleetCustomer.id fleetCus,phone,qq,comment");
    }
}
